package cn.iocoder.yudao.module.service.controller.open.introconfig;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.service.controller.admin.introconfig.vo.ServiceIntroConfigPageReqVO;
import cn.iocoder.yudao.module.service.controller.admin.introconfig.vo.ServiceIntroConfigRespVO;
import cn.iocoder.yudao.module.service.controller.admin.introconfig.vo.ServiceIntroConfigSaveReqVO;
import cn.iocoder.yudao.module.service.dal.dataobject.introconfig.ServiceIntroConfigDO;
import cn.iocoder.yudao.module.service.service.introconfig.ServiceIntroConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "客服系统 - 客服简介配置")
@RestController
@RequestMapping("/service/intro-config")
@Validated
public class OpenIntroConfigController {

    @Resource
    private ServiceIntroConfigService introConfigService;

    @GetMapping("/get")
    @OperateLog(enable = false)
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    @Parameter(name = "tenantId", description = "编号", required = true, example = "1024")
    public CommonResult<ServiceIntroConfigRespVO> getIntroConfig(@RequestParam("id") Long id, @RequestParam("tenantId") Long tenantId) {
        ServiceIntroConfigDO welcomeConfig = introConfigService.getIntroConfig(id, tenantId);
        return success(BeanUtils.toBean(welcomeConfig, ServiceIntroConfigRespVO.class));
    }

    @GetMapping("/get2")
    @OperateLog(enable = false)
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    public CommonResult<Long> get(@RequestParam("id") Long id) {
        return success(id);
    }


}